import { Moment } from 'moment';
import { OrderStates } from 'app/shared/model/enumerations/order-states.model';

export interface IOrder {
  id?: number;
  orderCode?: string;
  orderTime?: Moment;
  cancelTime?: Moment;
  dealTime?: Moment;
  sendTime?: Moment;
  marginTime?: Moment;
  payTime?: Moment;
  checkedTime?: Moment;
  userId?: number;
  itemTypeId?: number;
  itemId?: number;
  orderPrice?: number;
  dealPrice?: number;
  isLockPrice?: boolean;
  states?: OrderStates;
  estimatesQty?: number;
  dealQty?: number;
}

export class Order implements IOrder {
  constructor(
    public id?: number,
    public orderCode?: string,
    public orderTime?: Moment,
    public cancelTime?: Moment,
    public dealTime?: Moment,
    public sendTime?: Moment,
    public marginTime?: Moment,
    public payTime?: Moment,
    public checkedTime?: Moment,
    public userId?: number,
    public itemTypeId?: number,
    public itemId?: number,
    public orderPrice?: number,
    public dealPrice?: number,
    public isLockPrice?: boolean,
    public states?: OrderStates,
    public estimatesQty?: number,
    public dealQty?: number
  ) {
    this.isLockPrice = this.isLockPrice || false;
  }
}
